package com.zh.work.service.platform.channel.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zh.work.dao.platform.channel.PayChannelMapper;
import com.zh.work.entity.channel.PayChannelEntity;
import com.zh.work.service.platform.channel.PayChannelService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * code is far away from bug with the animal protecting
 * ┏┓　　　┏┓
 * ┏┛┻━━━┛┻┓
 * ┃　　　　　　　┃
 * ┃　　　━　　　┃
 * ┃　┳┛　┗┳　┃
 * ┃　　　　　　　┃
 * ┃　　　┻　　　┃
 * ┃　　　　　　　┃
 * ┗━┓　　　┏━┛
 * 　　┃　　　┃神兽保佑
 * 　　┃　　　┃代码无BUG！
 * 　　┃　　　┗━━━┓
 * 　　┃　　　　　　　┣┓
 * 　　┃　　　　　　　┏┛
 * 　　┗┓┓┏━┳┓┏┛
 * 　　　┃┫┫　┃┫┫
 * 　　　┗┻┛　┗┻┛
 *
 * @Description: 代付渠道管理设置业务逻辑实现层
 * @Author: Li.HuiNeng
 * @Create in: 2019/12/26
 * @Version: 1.0.1
 */
@Service
public class PayChannelServiceImpl extends ServiceImpl<PayChannelMapper, PayChannelEntity> implements PayChannelService {

    @Autowired
    private PayChannelMapper mapper;


    @Override
    public IPage<PayChannelEntity> getPagesPayChannels(Page<PayChannelEntity> page, PayChannelEntity payChannelEntity) {
        return mapper.selectPage(page, new LambdaQueryWrapper<PayChannelEntity>()
                .like(StringUtils.isNotEmpty(payChannelEntity.getChannelCode()), PayChannelEntity::getChannelCode, payChannelEntity.getChannelCode())
                .like(StringUtils.isNotEmpty(payChannelEntity.getChannelName()), PayChannelEntity::getChannelName, payChannelEntity.getChannelName())
        );
    }
}
